
<?php
//模块插件类
//对外接口函数类，其他插件可通过“$this->plugin('模块名称')->方法名” 来调用本类的方法
defined('BY_JYA') or exit('error');
class func_jy_orc extends plugin{
	public function card($image,$type){
		$setting=$this->get_setting();
		$appid=$setting['appid'];
		$appsecret=$setting['appsecret'];
		$token = cfc('account')->getAccessToken();
		$url='http://api.weixin.qq.com/cv/ocr/idcard?type=MODE&img_url=ENCODE_URL&access_token='.$token;
		$uid=$_SERVER['HTTP_HOST'];
		$image=base64_encode(file_get_contents($image));
		if($type=='idcard'){
			$url='http://api.weixin.qq.com/cv/ocr/idcard?type=MODE&access_token='.$token;
		}elseif($type=='bankcard'){
			$url='http://api.weixin.qq.com/cv/ocr/bankcard?type=MODE&access_token='.$token;
		}else($type=='driving'){
			$url='http://api.weixin.qq.com/cv/ocr/driving?type=MODE&access_token='.$token;
		}
		$post=array(
		'img_url'=>$image,
		);
		$result=cfc('http')->ihttp_request($url,json_encode($post));
		
		return $result['content'];
		
	}
}
?>
